package com.health.db.service.msg.impl;

import java.util.List;

import com.health.db.dao.msg.IImMsgNoticeDao;
import com.health.db.model.ImMsgNotice;
import com.health.db.model.ImMsgNoticeExample;
import com.health.db.service.msg.ImMsgNoticeService;

/**
 * Created by yuchong on 2017/4/20.
 */
public class ImMsgNoticeServiceImpl implements ImMsgNoticeService {

    private IImMsgNoticeDao imMsgNoticeDao;

	@Override
	public int insert(ImMsgNoticeExample record) {
		// TODO Auto-generated method stub
		ImMsgNotice updateRecord = new ImMsgNotice();
		updateRecord.setIsUsedFlag((short) -1);
		updateRecord.setNoticeReceiveAddress(record.getNoticeReceiveAddress());
		imMsgNoticeDao.updateForUserd(updateRecord);
		
		imMsgNoticeDao.insert(record);
	
		return 0;
	}

	@Override
	public List<ImMsgNotice> selectByExample(ImMsgNoticeExample example) {
		// TODO Auto-generated method stub
		return imMsgNoticeDao.selectByExample(example);
	}
	
	@Override
	public int updateForUserd(ImMsgNoticeExample example) {
		// TODO Auto-generated method stub
		return imMsgNoticeDao.updateForUserd(example);
	}


	@Override
	public int updateByPrimaryKeySelective(ImMsgNotice record) {
		// TODO Auto-generated method stub
		return imMsgNoticeDao.updateByPrimaryKeySelective(record);
	}

	/**
	 * @return the imMsgNoticeDao
	 */
	public IImMsgNoticeDao getImMsgNoticeDao() {
		return imMsgNoticeDao;
	}

	/**
	 * @param imMsgNoticeDao the imMsgNoticeDao to set
	 */
	public void setImMsgNoticeDao(IImMsgNoticeDao imMsgNoticeDao) {
		this.imMsgNoticeDao = imMsgNoticeDao;
	}

	@Override
	public int countNotice(ImMsgNoticeExample example) {
		// TODO Auto-generated method stub
		return imMsgNoticeDao.countNotice(example);
	}

	@Override
	public boolean checkNotice(ImMsgNoticeExample example) {
		// TODO Auto-generated method stub
		return imMsgNoticeDao.checkNotice(example);
	}

	

}
